-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rpc] add limit to object_ids #2701
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@@ -122,6 +122,7 @@ impl RpcService { | |||
access_path: AccessPath, | |||
state_root: Option<H256>, | |||
) -> Result<Vec<Option<ObjectState>>> { | |||
access_path.validate_max_object_ids()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以考虑把 access_path 的校验放到 rpc_server中完成,rpc_server是 rpc 的入口层,参数校验都可以在这一层完成
@@ -291,6 +291,19 @@ impl AccessPath { | |||
}) | |||
} | |||
|
|||
pub fn validate_max_object_ids(&self) -> Result<()> { | |||
const MAX_OBJECT_IDS: usize = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议定义成全局的pub const,用于 object ids 的判断
90ae4c5
to
e577d35
Compare
avoid oom